<?php
/**
 * @copyright meila.com
 * @author shaopu@
 * @name 
 * @param 
 *         $xxx = 作用
 * @static 
 *         XXX = 作用
 * 
 * 
 */
$dir = dirname(dirname(__FILE__));
include($dir.'/__queue_global.php');

class ml_mq_del_atme extends MqClass{
    const QUEUE_NAME = ML_QUEUENAME_DEL_ATME;

    private $oAtme ;
    private $oAct2atme ;
    
    public function __construct($queue)
    {
        $this->oAtme = new ml_model_dbAtMe();
        $this->oAct2atme = new ml_model_dbAct2atme();
        
        parent::__construct($queue);
    }
    /**
     * 注释
     *
     * @param array $message_data
     * array(
     *                        所接收的参数说明
     *        )
     * )
     */
    public function run_job(){
        
        $arr = $this->src_data;
        $rid = $arr['rid'];
        
        $rs = $this->oAct2atme->get_act2atme($rid);
        $row = $this->oAct2atme->get_data();
        if($row)
        {
            $aAtmeRid = $row['target_info'];
            foreach ($aAtmeRid as $rid)
            {
                $uid = ml_tool_resid::resid2uid($rid);
                $id = ml_tool_resid::resid2id($rid);
                
                $this->oAtme->del_by_id($uid , $id);
            }
        }
        return true;
    }

}


ml_run_queue_check(ml_mq_del_atme::QUEUE_NAME);

$conf_array = ml_factory::load_standard_conf('redis');
$conf_array = $conf_array['meila_queue'];
$xblog_obj = new ml_mq_del_atme(new RsQueue(ml_mq_del_atme::QUEUE_NAME));
$argv[1]   = __FILE__;
$xblog_obj->setArgv($argv[1]);
$xblog_obj->execute();
?>